<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>LibPcap, WinPcap and BPF</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><meta name="keywords" content="Intellon, Atheros, Qualcomm, HomePlug, powerline, communications, INT6000, INT6300, INT6400, AR7400, AR7420"><link rel="home" href="index.html" title="Qualcomm Atheros Open Powerline Toolkit"><link rel="up" href="ch03.html" title="Chapter 3.  Software"><link rel="prev" href="ch03s10.html" title="Compiler Constants"><link rel="next" href="ch03s12.html" title="Structure Packing"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">
				<span class="application">LibPcap</span>,  <span class="application">WinPcap</span> and <span class="application">BPF</span>
				</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s10.html">Prev</a> </td><th width="60%" align="center">Chapter 3. 
		Software 
		</th><td width="20%" align="right"> <a accesskey="n" href="ch03s12.html">Next</a></td></tr></table><hr></div><div class="section" title="LibPcap, WinPcap and BPF"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="software-packet-capture"></a>
				<span class="application">LibPcap</span>,  <span class="application">WinPcap</span> and <span class="application">BPF</span>
				</h2></div></div></div><p>
				<span class="application">LibPcap</span> is an open source Ethernet packet capture library that is widely used. It provides core functionality for the <span class="application">Wireshark</span> packet sniffer, formerly known as <span class="application">Ethereal</span>.
<span class="application">LibPcap</span> libraries are available for Linux and OpenBSD. On Linux and OpenBSD you must link applications to  <code class="filename">libpcap.a</code> and <code class="filename">libwpcap.a</code>. The toolkit does not use either of these libraries on Linux because they are not needed there. 
				</p><p>
				<span class="application">WinPcap</span> is an open source version of <span class="application">LibPcap</span> written for Microsoft <span class="productname">Windows</span>™. The <span class="application">WinPcap</span> libraries let Windows applications send and receive raw packets. On <span class="productname">Windows</span>™ you must link applications to <code class="filename">Packet.lib</code> and <code class="filename">wpcap.lib</code>.
				</p><p>
				In principle, the <span class="application">LibPcap</span> and <span class="application">WinPcap</span> library implementations should function identically but they do not;  however,  they are similar enough to provide a useful degree of platform independence. Defining preprocessor constants <code class="constant">LIBPCAP</code> or <code class="constant">WINPCAP</code> when compiling the toolkit will enable the corresponding source code. This can be done by adding "-DLIBPCAP" or "-DWINPCAP" to variable <code class="varname">LFLAGS</code> in file <code class="filename">Makefile</code> in folders int6k, int6k2, efsu and hpav. Constant <code class="constant">WINPCAP</code> need only be defined this way when compiling the toolkit using <span class="productname">cygwin</span>™ or <span class="productname">mingw</span>™ environments. Do not define both constants <code class="constant">LIBPCAP</code> and <code class="constant">WINPCAP</code> at the same time or compiler errors will occur. 
				</p><p>
				Berkeley Packet Filters (<acronym class="acronym">BPF</acronym>) is an open source Ethernet packet capture mechanism available on many <span class="productname">UNIX</span>™-like systems. Native <acronym class="acronym">BPF</acronym> is supported on some systems but must be explicitly compiled into the kernel on other systems. <span class="productname">Linux</span>™ systems normally do not support <acronym class="acronym">BPF</acronym> by default but <span class="productname">Mac OS X</span>™ does and so we automatically use it whenever compiler constant <code class="constant">__APPLE__</code> is defined. In principle, one could compile a custom <span class="productname">Linux</span>™ kernel with <acronym class="acronym">BPF</acronym> enabled.  
				</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s10.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s12.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">
				Compiler Constants
				 </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
				Structure Packing 
				</td></tr></table></div></body></html>
